﻿using System.Windows;

namespace Tequila.Phone.Infrastructure.Localization
{
    internal static class Extensions
    {
        public static T GetCurrentLocalizationManager<T>(this Application application)
            where T : class, ILocalizationManager
        {
            return application == null
                       ? null
                       : application.Resources.Contains("localizationmanager")
                             ? application.Resources["localizationmanager"] as T
                             : application.Resources.Contains("localizationManager")
                                   ? application.Resources["localizationManager"] as T
                                   : null;
        }
    }
}
